#ifndef CONFIG_H_

#define CONFIG_H_

#include <string>

#include "common.h"


class Config{
	public:
		enum SCH_SOURCE{
			SCH_SEQUENTIAL,
			SCH_RANDOM,
			SCH_TRACE,
		};
		enum TOPO_SOURCE{
			TOPO_STATIC,
			TOPO_FILE
		};
	public:
		Config();
		bool init( const char * file );

		struct{
			sim_time_t finish_time;
		}simulator_;

		struct{
			bool random_seed;
			long seed;
		}rng_;

		struct{
			bool toscreen;
			bool flush;
			bool sch;
			bool trans;
			bool debug;
			bool error;
			bool result;
			bool chord;
			std::string file_name;
		}loger_;

		struct{
			SCH_SOURCE node_source;
			std::string trace_file;
			sim_time_t interval;//inter-arrival time
			sim_time_t lifespan;//online duration
			int        init_size;
			sim_time_t start_time;
			sim_time_t failure_time;
			double	   failure_portion;

			sim_time_t dump_time;

			struct{
				bool       enable;
				SCH_SOURCE source;
				sim_time_t start_time;
				sim_time_t interval;
				int        number;
			}search_;

			struct{
				sim_time_t start_time;
			}merge_;
		}scheduler_;

		struct{
			TOPO_SOURCE topo_source;
			int network_size;
		}undertopo_;

		struct{
			int number;
			bool reserve;
			int initial_chord_size;
			int number_of_key;
			int power_of_n;
		}chordgod_;

		struct{
			int search_max_hops;
			sim_time_t stabilize_intv;
			sim_time_t check_keys_intv;
		}chordprot_;

};

extern Config config;

#endif /* CONFIG_H_ */

